package com.ruoyi.supermarket.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.supermarket.mapper.OrderRecordMapper;
import com.ruoyi.supermarket.domain.OrderRecord;
import com.ruoyi.supermarket.service.OrderRecordService;

/**
 * 订单记录Service业务层处理
 * 
 * @author 李其伟
 * @date 2023-11-13
 */
@Service
public class OrderRecordServiceImpl implements OrderRecordService
{
    @Autowired
    private OrderRecordMapper orderRecordMapper;

    /**
     * 查询订单记录
     * 
     * @param id 订单记录主键
     * @return 订单记录
     */
    @Override
    public OrderRecord selectOrderRecordById(Long id)
    {
        return orderRecordMapper.selectOrderRecordById(id);
    }

    /**
     * 查询订单记录列表
     * 
     * @param orderRecord 订单记录
     * @return 订单记录
     */
    @Override
    public List<OrderRecord> selectOrderRecordList(OrderRecord orderRecord)
    {
        return orderRecordMapper.selectOrderRecordList(orderRecord);
    }

    /**
     * 查询订单记录列表
     *
     * @param orderSns 订单号集合
     * @return 订单记录集合
     */
    @Override
    public List<OrderRecord> selectOrderRecordByOrderSn(String[] orderSns) {
        return orderRecordMapper.selectOrderRecordByOrderSn(orderSns);
    }

    /**
     * 新增订单记录
     * 
     * @param orderRecord 订单记录
     * @return 结果
     */
    @Override
    public int insertOrderRecord(OrderRecord orderRecord)
    {
        orderRecord.setCreateTime(DateUtils.getNowDate());
        return orderRecordMapper.insertOrderRecord(orderRecord);
    }

    /**
     * 修改订单记录
     * 
     * @param orderRecord 订单记录
     * @return 结果
     */
    @Override
    public int updateOrderRecord(OrderRecord orderRecord)
    {
        return orderRecordMapper.updateOrderRecord(orderRecord);
    }

    /**
     * 批量删除订单记录
     * 
     * @param ids 需要删除的订单记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderRecordByIds(Long[] ids)
    {
        return orderRecordMapper.deleteOrderRecordByIds(ids);
    }

    /**
     * 删除订单记录信息
     * 
     * @param id 订单记录主键
     * @return 结果
     */
    @Override
    public int deleteOrderRecordById(Long id)
    {
        return orderRecordMapper.deleteOrderRecordById(id);
    }
}
